﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

// std headers
#include <string>
#include <memory>

// custom headers
#include "HomeDefines.h"

namespace gmepgcs
{
    struct GCS_CORE_EXPORTS ILegend
    {
    public:
          enum class LegendType : int32_t // 与gemp::LegendType 对应
          {
              Invalid = 0,
              Plan = 1,
              Elevation = 2,
              Profile = 3,
              Electric = 4 //电气专业图例
          };

    public:
        explicit ILegend();
        virtual ~ILegend();
        std::shared_ptr<ILegend> Clone();


    public:
        bool operator==(const ILegend &other);
        bool operator!=(const ILegend &other);

    public:
        int64_t Id = -1;
        std::wstring Uid;
        std::wstring Name = L"";
        LegendType Type = LegendType::Invalid;
        std::wstring Thumbnail = L"";
        std::wstring StandardSource = std::wstring();

        int PlaceholderFrom = 2;    //0 公共库 1企业库 2 共享空间 3 项目图例库
        int EnterpriseResourceVersion = 1;

        // 企业库 对应资源ID
        std::wstring EnterpriseResourceId;
        // 企业库 (图片 信息 等 )单元ID
        std::wstring EnterpriseSPUId;

        std::wstring EnterpriseGacFileKey;

    public:
        static int32_t GetLegendTypeInDigitalModule(ILegend::LegendType legendType);
        static std::wstring GetTypeName(ILegend::LegendType legendType);
        static bool GetMajorTypeName(const ILegend::LegendType legendType, std::wstring& major, std::wstring& type);
    };
}